#pragma once

#include <iostream>
#include <string>
#include <fstream>

class Util
{
public:
    static std::string getOneline(std::string &buffer, const std::string &sep)
    {
        auto pos = buffer.find(sep);
        if (pos == std::string::npos)
            return "";
        std::string sub = buffer.substr(0, pos);
        buffer.erase(0, sub.size() + sep.size());
        return sub;
    }

    static bool readFile(const std::string rescource, std::string *out)
    {
        std::ifstream in(rescource);
        if (!in.is_open())
            return false;

        std::string line;
        while(std::getline(in,line))
        {
            *out += line;
        }
        
        in.close();
        return true;
    }
};